//
//  XFJAnnotation.swift
//  亿享_04
//
//  Created by ibokan on 2017/7/18.
//  Copyright © 2017年 ibokan. All rights reserved.
//

import MapKit
import UIKit

class XFJAnnotation: NSObject , MKAnnotation{
    //位置坐标
    var coordinate : CLLocationCoordinate2D = CLLocationCoordinate2DMake(0, 0)
    //标题和子标题
    var title : String?
    var subtitle : String?
}
extension MessageViewController {
    private func addAnntation(coordinate : CLLocationCoordinate2D, title : String?, subtitle : String?) ->XFJAnnotation
    {
        //创建大头针
        let annotation = XFJAnnotation()
        //设置标题
        annotation.title = title
        annotation.subtitle = subtitle
        //设置大头针的位置
        annotation.coordinate = coordinate
        //添加大头针
        self.mainMapView.addAnnotation(annotation)
        //返回大头针
        return annotation
    }
}

